//
//  TabBarVC.swift
//  SelfGoodAsOldPhomes
//
//  Created by panda on 17/3/14.
//  Copyright © 2017年 panda. All rights reserved.
//

import UIKit

class TabBarVC: UITabBarController {

    override func viewDidLoad() {
        super.viewDidLoad()

        // Do any additional setup after loading the view.
        createChildVC()
    }
    
    func createChildVC() {
        let navVC = NavVC();
        navVC.title = "导航";
        let nav = UINavigationController.init(rootViewController: navVC);
        
        let vc = ViewController();
        vc.title = "另一个"
        
        let color = UIColor.init(red: 1.0, green: 0.0, blue: 0.0, alpha: 1.0);
        let navItem = UITabBarItem.init(title: "控制器", image: UIImage(named: "footbar_home_nor"), selectedImage: UIImage(named: "footbar_home_press"))
        navItem.setTitleTextAttributes([NSForegroundColorAttributeName: color], for: UIControlState.highlighted)
        navVC.tabBarItem = navItem;
        navVC.tabBarItem.selectedImage = UIImage(named: "footbar_home_press")?.withRenderingMode(UIImageRenderingMode.alwaysOriginal)
        
        let vcItem = UITabBarItem.init(title: "控制器", image: UIImage(named: "footbar_my_nor"), selectedImage: UIImage(named: "footbar_my_press"))
        vcItem.setTitleTextAttributes([NSForegroundColorAttributeName: color], for: UIControlState.highlighted);
        vc.tabBarItem = vcItem;
        
//        let filtered = imageName.replacingOccurrences(of: "nor", with: "press")
        
        vc.tabBarItem.selectedImage = UIImage(named: "footbar_my_press")?.withRenderingMode(UIImageRenderingMode.alwaysOriginal)
        
        
        let tabArr = [nav, vc];
        self.viewControllers = tabArr;
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
    

    /*
    // MARK: - Navigation

    // In a storyboard-based application, you will often want to do a little preparation before navigation
    override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
        // Get the new view controller using segue.destinationViewController.
        // Pass the selected object to the new view controller.
    }
    */

}
